import {SIOSession} from "./SIOSession";

export class SocketIO {
    readonly session: SIOSession

    constructor(host: string)
    constructor(session: SIOSession)
    constructor(hostOrSession: string | SIOSession) {
        if (typeof hostOrSession === 'string') {
            this.session = new SIOSession(hostOrSession);
        } else {
            this.session = hostOrSession;
        }
    }
}

export let shared = new SocketIO('wss://zhwy.zh-lbs.com/api/msg/ws/')

export function reset() {
    shared.session.close()
    shared = new SocketIO('wss://zhwy.zh-lbs.com/api/msg/ws/')
}